import * as http from '@api/http'

/**
 * @purpose 通过地址获取经纬度
 * @param address
 * @returns {*}
 */
export function getLocationByAddress (address = '') {
  return http
    .get('map.getLocationByAddress', {
      address: address
    })
    .then(r => r.data)
}
// 通过经纬度获取地址
export function getAddressByLocation (location = '') {
  return http
    .get('map.getAddressByLocation', {
      location: location
    })
    .then(r => r.data)
}
// 保存提交
export function addCollectionPoint (params) {
  return http
    .post('map.addCollectionPoint', params)
    .then(r => r.data)
}
// 获取地址信息
export function getInfo (page = 1, size = 40) {
  return http
    .get('map.getInfo', {
      page: page,
      size: size
    })
    .then(r => r.data)
}
// 搜索获取地址信息
export function searchInfo (params) {
  return http
    .get('map.getInfo', params)
    .then(r => r.data)
}
// 删除一行信息
export function deleteInfo (id) {
  return http
    .post('map.deleteInfo', {
      id: id
    })
    .then(r => r.data)
}
// 编辑信息
export function editorInfo (params) {
  return http
    .post('map.editorInfo', params)
    .then(r => r.data)
}
